#include <bits/stdc++.h>
using namespace std;
const int M = 100005;
int n,a[M],k = 0;
vector<int> v[M];
int vmax[M];
int findpos(int num)
{
    int l = 1,r = k + 1;
    while (l < r - 1)
    {
        int mid = (l + r) / 2;
        if (vmax[mid] < num)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    if (num > vmax[l])
    {
        return l;
    }
    return r;
}
void addto(int x)
{
    int pos = findpos(x);
    if (pos > k)
    {
        v[++k].push_back(x);
        vmax[k] = x;
        return ;
    }
    v[pos].push_back(x);
    vmax[pos] = x;
    return ;

}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for (int i = 1; i <= n; i++)
    {
        cin>>a[i];
    }
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++)
    {
        addto(a[i]);
    }
    cout<<k<<endl;
    return 0;
}

